'\" te
.\"  Copyright (c) 1996, Sun Microsystems, Inc.  All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH CSX_GETSTATUS 9F "Jul 19, 1996"
.SH NAME
csx_GetStatus \- return the current status of a PC Card and its socket
.SH SYNOPSIS
.nf
#include <sys/pccard.h>



\fBint32_t\fR \fBcsx_GetStatus\fR(\fBclient_handle_t\fR \fIch\fR, \fBget_status_t *\fR\fIgs\fR);
.fi

.SH INTERFACE LEVEL
illumos \fBDDI \fRSpecific (illumos \fBDDI) \fR
.SH PARAMETERS
.ne 2
.na
\fB\fIch\fR \fR
.ad
.RS 7n
Client handle returned from \fBcsx_RegisterClient\fR(9F).
.RE

.sp
.ne 2
.na
\fB\fIgs\fR \fR
.ad
.RS 7n
Pointer to a \fBget_status_t\fR structure.
.RE

.SH DESCRIPTION
This function returns the current status of a \fBPC \fRCard and its socket.
.SH STRUCTURE MEMBERS
The structure members of \fBget_status_t\fR are:
.sp
.in +2
.nf
uint32_t     Socket;          /* socket number*/
uint32_t     CardState;       /* "live" card status for this client*/
uint32_t     SocketState;     /* latched socket values */
uint32_t     raw_CardState;   /* raw live card status */
.fi
.in -2

.sp
.LP
The fields are defined as follows:
.sp
.ne 2
.na
\fB\fBSocket\fR \fR
.ad
.RS 18n
Not used in illumos, but for portability with other Card Services
implementations, it should be set to the logical socket number.
.RE

.sp
.ne 2
.na
\fB\fBCardState\fR \fR
.ad
.RS 18n
The \fBCardState\fR field is the bit-mapped output data returned from Card
Services. The bits identify what Card Services thinks the current state of the
installed \fBPC \fRCard is. The bits are:
.sp
.ne 2
.na
\fBCS_STATUS_WRITE_PROTECTED\fR
.ad
.sp .6
.RS 4n
Card is write protected
.RE

.sp
.ne 2
.na
\fBCS_STATUS_CARD_LOCKED\fR
.ad
.sp .6
.RS 4n
Card is locked
.RE

.sp
.ne 2
.na
\fBCS_STATUS_EJECTION_REQUEST\fR
.ad
.sp .6
.RS 4n
Ejection request in progress
.RE

.sp
.ne 2
.na
\fBCS_STATUS_INSERTION_REQUEST\fR
.ad
.sp .6
.RS 4n
Insertion request in progress
.RE

.sp
.ne 2
.na
\fBCS_STATUS_BATTERY_DEAD\fR
.ad
.sp .6
.RS 4n
Card battery is dead
.RE

.sp
.ne 2
.na
\fBCS_STATUS_BATTERY_DEAD\fR
.ad
.sp .6
.RS 4n
Card battery is dead (\fBBVD1\fR)
.RE

.sp
.ne 2
.na
\fBCS_STATUS_BATTERY_LOW\fR
.ad
.sp .6
.RS 4n
Card battery is low (\fBBVD2\fR)
.RE

.sp
.ne 2
.na
\fBCS_STATUS_CARD_READY\fR
.ad
.sp .6
.RS 4n
Card is READY
.RE

.sp
.ne 2
.na
\fBCS_STATUS_CARD_INSERTED\fR
.ad
.sp .6
.RS 4n
Card is inserted
.RE

.sp
.ne 2
.na
\fBCS_STATUS_REQ_ATTN\fR
.ad
.sp .6
.RS 4n
Extended status attention request
.RE

.sp
.ne 2
.na
\fBCS_STATUS_RES_EVT1\fR
.ad
.sp .6
.RS 4n
Extended status reserved event status
.RE

.sp
.ne 2
.na
\fBCS_STATUS_RES_EVT2\fR
.ad
.sp .6
.RS 4n
Extended status reserved event status
.RE

.sp
.ne 2
.na
\fB CS_STATUS_RES_EVT3\fR
.ad
.sp .6
.RS 4n
Extended status reserved event status
.RE

.sp
.ne 2
.na
\fBCS_STATUS_VCC_50\fR
.ad
.sp .6
.RS 4n
5.0 Volts Vcc Indicated
.RE

.sp
.ne 2
.na
\fBCS_STATUS_VCC_33\fR
.ad
.sp .6
.RS 4n
3.3 Volts Vcc Indicated
.RE

.sp
.ne 2
.na
\fBCS_STATUS_VCC_XX\fR
.ad
.sp .6
.RS 4n
X.X Volts Vcc Indicated
.RE

The state of the \fBCS_STATUS_CARD_INSERTED\fR bit indicates whether the \fBPC
\fRCard associated with this driver instance, not just any card, is inserted in
the socket. If an \fBI/O \fRcard is installed in the specified socket, card
state is returned from the \fBPRR\fR (Pin Replacement Register) and the
\fBESR\fR (Extended Status Register) (if present). If certain state bits are
not present in the \fBPRR\fR or \fBESR\fR, a simulated state bit value is
returned as defined below:
.sp
.ne 2
.na
\fBCS_STATUS_WRITE_PROTECTED\fR
.ad
.RS 29n
Not write protected
.RE

.sp
.ne 2
.na
\fBCS_STATUS_BATTERY_DEAD\fR
.ad
.RS 29n
Power good
.RE

.sp
.ne 2
.na
\fBPCS_STATUS_BATTERY_LOW\fR
.ad
.RS 29n
Power good
.RE

.sp
.ne 2
.na
\fBCS_STATUS_CARD_READY\fR
.ad
.RS 29n
Ready
.RE

.sp
.ne 2
.na
\fBCS_STATUS_REQ_ATTN\fR
.ad
.RS 29n
Not set
.RE

.sp
.ne 2
.na
\fBCS_STATUS_RES_EVT1\fR
.ad
.RS 29n
Not set
.RE

.sp
.ne 2
.na
\fBCS_STATUS_RES_EVT2\fR
.ad
.RS 29n
Not set
.RE

.sp
.ne 2
.na
\fBCS_STATUS_RES_EVT3\fR
.ad
.RS 29n
Not set
.RE

.RE

.sp
.ne 2
.na
\fB\fBSocketState\fR \fR
.ad
.RS 18n
The \fBSocketState\fR field is a bit-map of the current card and socket state.
The bits are:
.sp
.ne 2
.na
\fBCS_SOCK_STATUS_WRITE_PROTECT_CHANGE\fR
.ad
.sp .6
.RS 4n
Write Protect
.RE

.sp
.ne 2
.na
\fBECS_SOCK_STATUS_CARD_LOCK_CHANGE\fR
.ad
.sp .6
.RS 4n
Card Lock Change
.RE

.sp
.ne 2
.na
\fBCS_SOCK_STATUS_EJECTION_PENDING\fR
.ad
.sp .6
.RS 4n
Ejection Request
.RE

.sp
.ne 2
.na
\fBCS_SOCK_STATUS_INSERTION_PENDING\fR
.ad
.sp .6
.RS 4n
Insertion Request
.RE

.sp
.ne 2
.na
\fBCS_SOCK_STATUS_BATTERY_DEAD_CHANGE\fR
.ad
.sp .6
.RS 4n
Battery Dead
.RE

.sp
.ne 2
.na
\fBCS_SOCK_STATUS_BATTERY_LOW_CHANGE\fR
.ad
.sp .6
.RS 4n
Battery Low
.RE

.sp
.ne 2
.na
\fBCS_SOCK_STATUS_CARD_READY_CHANGE\fR
.ad
.sp .6
.RS 4n
Ready Change
.RE

.sp
.ne 2
.na
\fBCS_SOCK_STATUS_CARD_INSERTION_CHANGE\fR
.ad
.sp .6
.RS 4n
Card is inserted
.sp
 The state reported in the SocketState field may be different from the state
reported in the CardState field. Clients should normally depend only on the
state reported in the CardState field.
.sp
The state reported in the \fBSocketState\fR field may be different from the
state reported in the \fBCardState\fR field. Clients should normally depend
only on the state reported in the \fBCardState\fR field.
.RE

.RE

.sp
.ne 2
.na
\fB\fBraw_CardState\fR \fR
.ad
.RS 18n
The \fBraw_CardState\fR field is an illumos-specific extension that allows the
client to determine if any card is inserted in the socket. The bit definitions
in the \fBraw_CardState\fR field are identical to those in the \fBCardState\fR
field with the exception that the \fBCS_STATUS_CARD_INSERTED\fR bit in the
\fBraw_CardState\fR field is set whenever any card is inserted into the socket.
.RE

.SH RETURN VALUES
.ne 2
.na
\fB\fBCS_SUCCESS\fR \fR
.ad
.RS 28n
Successful operation.
.RE

.sp
.ne 2
.na
\fB\fBCS_BAD_HANDLE\fR \fR
.ad
.RS 28n
Client handle is invalid.
.RE

.sp
.ne 2
.na
\fB\fBCS_BAD_SOCKET\fR \fR
.ad
.RS 28n
Error getting socket state.
.RE

.sp
.ne 2
.na
\fB\fBCS_UNSUPPORTED_FUNCTION\fR \fR
.ad
.RS 28n
No \fBPCMCIA \fRhardware installed.
.RE

.sp
.LP
\fBCS_NO_CARD\fR will not be returned if there is no \fBPC \fRCard present in
the socket.
.SH CONTEXT
This function may be called from user or kernel context.
.SH SEE ALSO
.BR csx_RegisterClient (9F)
.sp
.LP
\fIPC Card 95 Standard, PCMCIA/JEIDA\fR
